//
//  DFProductsProductDetailCell.m
//  DFront
//
//  Created by lanou on 15/10/26.
//  Copyright © 2015年 xuzenghui. All rights reserved.
//
#define kHeighth self.contentView.bounds.size.height
#import "DFProductsProductDetailCell.h"

@implementation DFProductsProductDetailCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        _name = [[UILabel alloc]initWithFrame:CGRectMake(10, 0, 100, kHeighth)];
        _name.font = [UIFont systemFontOfSize:15];
        _value = [[UILabel alloc]initWithFrame:CGRectMake(100, 0, kScreenWidth - 130, 30)];
        _value.numberOfLines = 0;
        _value.font = [UIFont systemFontOfSize:15];
        
        [self.contentView addSubview:_name];
        [self.contentView addSubview:_value];
    }
    return self;
}

+ (CGFloat)heightOfString:(NSString*)string
{
    CGRect bounds = [string boundingRectWithSize:CGSizeMake(kScreenWidth - 130, 0) options:NSStringDrawingUsesLineFragmentOrigin attributes:[NSDictionary dictionaryWithObject:[UIFont systemFontOfSize:15] forKey:NSFontAttributeName] context:nil];
    return bounds.size.height;
}


+ (CGFloat)heithtOfCell:(NSString *)string
{
    return [self heightOfString:string] + 20;
}
- (void)configureDataWithModel:(DFProductsProductsortParam *)model
{
    self.name.text = [model.name stringByAppendingString:@"   :"];
    self.value.text = model.vale;
    
    self.name.frame = CGRectMake(10, 0, 120, 20 + [DFProductsProductDetailCell heightOfString:model.vale]);
    self.value.frame = CGRectMake(120, 0, kScreenWidth - 130,20 + [DFProductsProductDetailCell heightOfString:model.vale]);
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
